<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="acanto" uri="http://freegas.googlecode.com/acanto-tabs-taglib" %>

<c:choose>
	<c:when test="${not empty requestScope.ds}">
		<c:set var="dataset" value="${requestScope.ds}" />		
	</c:when>
	<c:when test="${not empty param.dsname}">
		<acanto:importComponents compName="${param.dsname}"/>
		<c:set var="dataset" value="${pageScope[param.dsname]}" />		
	</c:when>
	<c:otherwise>
		<span class="error">Paging bar cannot retrieve dataset</span>		
	</c:otherwise>
</c:choose>

<c:choose>
	<c:when test="${not empty dataset and dataset.availableRows > 0}">
		<acanto:datatable htmlClass="page_navigation" dataset="${dataset}">
			<tr>
				<td>
					<dl>
						<dt>Trovati:</dt>
						<dd><c:out value="${dataset.availableRows}"/></dd>
					</dl>
				</td>
	
				<td>
					<dl>
						<dt>Risultati per pagina:</dt>
						<dd><acanto:editProperty onSubmit="true" property="${dataset.id}.resultsPerPage"/></dd>
					</dl>
				</td>									
				<c:if test="${dataset.availableRows > dataset.resultsPerPage and dataset.resultsPerPage > 0}">		
					<td style="text-align:right;">
						<acanto:firstPage>
							<acanto:enabled>&laquo;</acanto:enabled>
							<acanto:disabled><font>&laquo;</font></acanto:disabled>					
						</acanto:firstPage>
						<acanto:previousPage>
							<acanto:enabled>&lsaquo;</acanto:enabled>
							<acanto:disabled><font>&lsaquo;</font></acanto:disabled>
						</acanto:previousPage>
							pag <acanto:editProperty property="${dataset.id}.currentPage"/> di <c:out value="${dataset.availablePages}"/>
						<acanto:nextPage>
							<acanto:enabled>&rsaquo;</acanto:enabled>
							<acanto:disabled><font>&rsaquo;</font></acanto:disabled>
						</acanto:nextPage>
						<acanto:lastPage>
							<acanto:enabled>&raquo;</acanto:enabled>
							<acanto:disabled><font>&raquo;</font></acanto:disabled>
						</acanto:lastPage>		
					</td>
				</c:if>
			</tr>
	
		</acanto:datatable>
	</c:when>
	<c:otherwise>
		<table class="page_navigation">
			<tr>
				<td>
					<dl>
						<dt>Non &egrave; stato trovato nessun record</dt>
					</dl>
				</td>
			</tr>
		</table>
	</c:otherwise>
</c:choose>
